<html>
    <head>
  <script src="jquery-3.3.1.js"></script>
  <script>
      $(function() {
      $("tr:gt(0):even").css("background-color","red");
      $("tr:gt(0):odd").css("background-color","pink");
      $("#button1").click(function() {
         
      var checkboxAll = $("input[name='checkbox1']");
      $.each(checkboxAll,function(){
          $(this).attr("checked", " checked");
      })
      })
      $("#button2").click(function() {
         
         var checkboxRe = $("input[name='checkbox1']");
         $.each(checkboxRe,function(){
             $(this).removeAttr("checked");
         })
         
      })
      $("#checkAll").click(function(){
            
             var checkAllsate = this.checked;
             var checkboxRe = $("input[name='checkbox1']");
               $.each(checkboxRe,function(){
                this.checked = checkAllsate;
                   
               })
            })
           
            $("input[name='checkbox1']").click(function(){
                var childBox = $("input[name='checkbox1']");
                var por = true
                $.each(childBox,function(){
                    if(!this.checked){
                        por = false;
                    }
                })
                $("#checkAll").prop("checked",por);

            })
              
            
      })
      
  </script>
  <style>
       table {
           border: 1px solid;
           width: 400px;
       }
       tr,th,td{
           border: 1px solid;
           
       }
  </style>
    </head>
    <body>
        <input type="button" name="check1" id="button1" value="全选">
        <input type="button" name="check1" id="button2" value="全不选
        ">
    <table>
        
        <tr>
            <td>     <input type="checkbox" name="checkbox" id="checkAll" value="全选">全选</td>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
        </tr>
            <tr>
                <td>     <input type="checkbox" name="checkbox1" ></td>
                <td>张三</td>
                <td>18</td>
                <td>男</td>
            </tr>
            <tr>
                <td>     <input type="checkbox" name="checkbox1" ></td>
                <td>李四</td>
                <td>17</td>
                <td>女</td>
            </tr>
                <tr>
                    <td>     <input type="checkbox" name="checkbox1" ></td>
                    <td>jack</td>
                    <td>18</td>
                    <td>男</td>
                </tr>
                <tr>
                    <td>     <input type="checkbox" name="checkbox1" ></td>
                    <td>rose</td>
                    <td>16</td>
                    <td>女</td>
                </tr>
            
     



    </table>
    </body>
</html>